<template>
	<view class="content">
		<placeAndSearch />
		<view class="contentBox">
			<view class="title f16">
				简单可靠，Life Go
			</view>
			<view class="list">
				<view class="hr"></view>
				<view :class="[(index == 4|| index == 5)?'noboder':'', 'item']" v-for="(item,index) in menulist"
					:key="index" @click="handClick(item)">
					<view class="fuc">
						<image :src="item.src" class="img"></image>
						<view class="itemTitle f16">
							{{item.title}}
						</view>
					</view>
					<!-- <view class="itemtxt f14">{{item.url}}</view> -->
					<view class="itemhref f14">{{item.intro}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import placeAndSearch from '@/components/placeAndSearch/placeAndSearch.vue';
	export default {
		components: {
			placeAndSearch,
		},
		data() {
			return {
				menulist: [{
						title: "时运高",
						// url: "LuckyLock.cn",
						introduce: "开锁换锁  汽车钥匙",
						src:"../../static/img/kaisuo.png"
					},
					{
						title: "宅吉搬",
						// url: "LuckyLock.cn",
						introduce: "开锁换锁  汽车钥匙",
						src:"../../static/img/banjia.png"
					},
					{
						title: "洁世邦",
						// url: "LuckyLock.cn",
						introduce: "开锁换锁  汽车钥匙",
						src:"../../static/img/baojie.png"
					},
					{
						title: "佳助守",
						// url: "LuckyLock.cn",
						introduce: "开锁换锁  汽车钥匙",
						src:"../../static/img/huli.png"
					},
					{
						title: "管道通",
						// url: "LuckyLock.cn",
						introduce: "开锁换锁  汽车钥匙",
						src:"../../static/img/tongqu.png"
					},
					{
						title: "嘉士援",
						// url: "LuckyLock.cn",
						introduce: "开锁换锁  汽车钥匙",
						src:"../../static/img/jiuyuan.png"
					}
				],
				res: "",
				userInfo: "",
				code:""
			}
		},
		onLoad() {
			//this.getlocationFn();
			this.getMenulist();
		},
		methods: {
			handClick(item, e) {
				console.log(item)
				if (item.mpMenuId == 1) {
					uni.navigateTo({
						url: '../luckLock/sendAddress/sendAddress?svcId='+item.mpMenuId
					})
				}
				if (item.mpMenuId == 2) {
					uni.navigateTo({
						url: '../luckLock/sendAddress/sendAddress_zhaijiban'
					})
				}
				if (item.mpMenuId == 3) {
					uni.navigateTo({
						url: '../luckLock/sendAddress/sendAddress_jieshibang'
					})
				}
				if (item.mpMenuId == 4) {
					uni.navigateTo({
						url: '../luckLock/sendAddress/sendAddress_jiazhushou'
					})
				}
				if (item.mpMenuId == 5) {
					uni.navigateTo({
						url: '../luckLock/sendAddress/sendAddress_guandangtong'
					})
				}
				if (item.mpMenuId == 6) {
					uni.navigateTo({
						url: '../luckLock/sendAddress/sendAddress_jiashiyuan'
					})
				}
			},
			test() {
				this.postApi('articleLists', 'POST', {
					data: {
						is_important: 1
					},
				}).then(res => {
					console.log(res)
					uni.getLocation({
						type: 'gcj02',
						altitude: true,
						success: function(res) {
							console.log(res)
							console.log('当前位置的经度：' + res.longitude);
							console.log('当前位置的纬度：' + res.latitude);
						}
					});

				}).catch(err => {
					console.log(err)
				})
			},
			getlocationFn(){
				
			},
			getMenulist(){
				//console.log('获取菜单')
				this.postApi('getMenulist', 'GET', {useToken:false}).then(res => {
					console.log('获取菜单',res)
					res.data.map((item,index)=>{
						item.src = this.menulist[index].src
					});
					 this.menulist = res.data
				}).catch(err => {
					console.log(err)
				})
			}
		}
	}
</script>

<style lang="less">
	@import '@/common/common.less';
	@import './index.less';
</style>
